// PropertyParser.cpp: implementation of the PropertyParser class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "PropertyParser.h"
#include "Property.h"

//#include "Property.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
//static char strPropertyParser[] = "PropertyParser"; 
//struct PropertyRuntimeClass PropertyParser::v_PropertyParser = {NULL,NULL,strPropertyParser};
//tatic Afx_Initclass int_PropertyParser(&PropertyParser::v_PropertyParser);

namespace pa
{
	PropertyParser::PropertyParser()
	{
		//v_PropertyParser.p_nRuntime = NULL;

	}

	PropertyParser::~PropertyParser()
	{

	}
	
	bool PropertyParser::IsLegeal(const OriginalProperty& OP)
	{
		
		return false;
	}

	Property* PropertyParser::NewProperty(const OriginalProperty& OP)
	{
		
		return NULL;
	}

	void PropertyParser::CopyPublicData(Property* pVariable,const OriginalProperty& OP)
	{
		pVariable->Description(OP->GetString(_T("Description")));
		pVariable->Default(OP->GetString(_T("Default")));
		pVariable->Unit(OP->GetString(_T("Unit")));
		pVariable->EffectField(OP->GetString(_T("EffectField")));
		pVariable->PropertyStyle(Property::eDB);
		pVariable->EffectCondition(OP->GetString(_T("EffectCondition")));
		pVariable->ExistCondition(OP->GetString(_T("ExistCondition")));
		pVariable->SetSave(OP->GetBool(_T("Save")));
		pVariable->Symbol(OP->GetString(_T("PropertyName")));

		Variable::VarType datatype;
		StdString strDataType = OP->GetString(_T("DataType"));
		if(strDataType == "double")
		{
			datatype = Variable::DOUBLEX;
		}
		else if( strDataType == "int")
		{
			datatype = Variable::INTEGER;
		}
		else if(strDataType == "string")
		{
			datatype = Variable::STRING;
		}
		else if(strDataType == "part")
		{
			datatype = Variable::PART;
		}
		else
		{
			ASSERT(false);
		}
		pVariable->DataType(datatype);
	}
	
};
